<?
//$code = $_lang == 'vn' ? 'vn_download' : 'en_download';
//$parentWhere = "and parent = (select id from tbl_content_category where code='$code')";

//$parentRecord = getRecord("tbl_content","1=1 ".$parentWhere);

//$cat1 = killInjection($_REQUEST['cat']);
/*if ($cat1=='') $cat1 = $parentRecord['parent'];
$per_page = 10;
$p=0;
if ($_REQUEST['p']!='') $p=killInjection($_REQUEST['p']);
$total = countRecord("tbl_content","status=0 and parent=".$cat1);
if($total==1){
?>
<table align="center" cellSpacing="0" cellPadding="0" width="100%" border="0">
	
	<tr>
		<td align="center">
			<font color="#FF0000"><b><?=$_lang=="vn"?'Dữ liệu đang cập nhật !':'Data are being updated !'?></b></font>
		</td>
	</tr>
	<tr><td height="20"></td></tr>
</table>
<?
}else{
$sql = "select * from tbl_content where status=0 $parentWhere order by sort,date_added desc limit ".$per_page*$p.",".$per_page;
$result = @mysql_query($sql,$conn);
?>
<table align="center" border="0" width="100%" cellspacing="0" cellpadding="0">
<? 
while($row=mysql_fetch_assoc($result)){
?>

	<tr>
		<td class="td1">
			<? if($row['image']){?>
			<?=$_lang=='vn'?'Tên tập tin : ':'File name : '?> 
			<a href="<?=$row['image']?>">
			<font color="#336699" size="-1"><?=$row['name']?></font>
			</a>
			<? }?>
			<br />
		
		</td>
		
	</tr>
	
	

<? }?>
</table>

<table align="center" cellSpacing=0 cellPadding=0 width="100%" border=0>
<?
$newsPage       = $_lang=="vn" ? "Tài liệu" : "Document";
$pagePage       = $_lang=="vn" ? "Trang" : "Page";
$titleFirst     = $_lang=="vn" ? "Đầu Tiên" : "First";
$titlePrevious  = $_lang=="vn" ? "Về trước" : "Previous";
$titleNext      = $_lang=="vn" ? "Tiếp theo" : "Next";
$titleLast      = $_lang=="vn" ? "Cuối cùng" : "Last";

$total=countRecord("tbl_content","status=0 and parent=".$cat1);
$pages = countPages($total,$per_page);
echo '<tr><td colspan="2" align="center"></td></tr>';
echo '<tr><td class="link" align="left"></td>';
echo '<td class="link" align="right">'.$pagePage.' : ';
$param="";
if ($p>1) echo '<a class="link111" title="'.$titleFirst.'" href="./?frame='.$_REQUEST['frame'].'&cat='.$_REQUEST['cat'].'&'.$param.'&p=0">[&lt;&lt;]</a> ';
if ($p>0) echo '<a class="link111" title="'.$titlePrevious.'" href="./?frame='.$_REQUEST['frame'].'&cat='.$_REQUEST['cat'].'&'.$param.'&p='.($p-1).'">[&lt;]</a> ';
$from=($p-10>0?$p-10:0);
$to=($p+10<$pages?$p+10:$pages);
for ($i=$from;$i<$to;$i++){
	if ($i!=$p) echo '<a class="link111" href="./?frame='.$_REQUEST['frame'].'&cat='.$_REQUEST['cat'].'&'.$param.'&p='.$i.'">'.($i+1).' </a>';
	else echo '<b>'.($i+1).'</b> ';
}
if ($p<$i-1) echo '<a class="link111" title="'.$titleNext.'" href="./?frame='.$_REQUEST['frame'].'&cat='.$_REQUEST['cat'].'&'.$param.'&p='.($p+1).'">[&gt;]</a> ';
if ($p<$pages-1) echo '<a class="link111" title="'.$titleLast.'" href="./?frame='.$_REQUEST['frame'].'&cat='.$_REQUEST['cat'].'&'.$param.'&p='.($pages-1).'">[&gt;&gt;]</a>'; 
echo '</td></tr>';
?>
</table>
<? }?>